<?php
namespace app\admin\validate;
use think\Validate;

class Admin extends Validate{
	protected $rule=[
		'username'=>'require|min:6|unique:admin',
		'password'=>'require|max:32',
	];

	protected $message=[
		'username.require'=>'名称必须填写',
		'username.min'=>'名称最少6个字符',
		'username.unique'=>'名称不能重复',
		'password.require'=>'密码必须填写',
		'password.max'=>'密码长度不能超过32个字符',	
	];

	protected $scene=[
		// 'add'=>['username'=>'require','password'], //限定在添加数据的时候只校验是否为空，不校验长度
		'add'=>['username','password'],
		'edit'=>['password'],
	];
}


?>